package com.myzhouye.biz.model;/***
 *                    _ooOoo_
 *                   o8888888o
 *                   88" . "88
 *                   (| -_- |)
 *                    O\ = /O
 *                ____/`---'\____
 *              .   ' \\| |// `.
 *               / \\||| : |||// \
 *             / _||||| -:- |||||- \
 *               | | \\\ - /// | |
 *             | \_| ''\---/'' | |
 *              \ .-\__ `-` ___/-. /
 *           ___`. .' /--.--\ `. . __
 *        ."" '< `.___\_<|>_/___.' >'"".
 *       | | : `- \`.;`\ _ /`;.`/ - ` : | |
 *         \ \ `-. \_ __\ /__ _/ .-` / /
 * ======`-.____`-.___\_____/___.-`____.-'======
 *                    `=---='
 *
 * .............................................
 *          佛祖保佑             永无BUG
 */

import jakarta.persistence.*;
import lombok.Data;

import java.time.LocalDateTime;

/**
 * @program: game01
 * @description: 用户工厂实体类
 * @author: 那条蠢鱼
 * @create: 2025-11-11 16:46
 **/
@Data
@Entity
@Table(name = "user_factory")
public class UserFactoryEntity {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id; // 数据库自增ID

    @Column(nullable = false)
    private Long userId; // 所属用户ID


    @Column(nullable = false)
    private String name; // 工厂名称

    @Column(nullable = false)
    private String productName; // 产品名称

    @Column(nullable = false)
    private Integer warehouseSize; // 仓库容量

    @Column(nullable = false)
    private Integer productNums; // 当前产品数量

    @Column(nullable = false)
    private double productionSpeed; // 生产速度(秒/个)

    @Column(nullable = false)
    private double acceleration; // 加速系数


    @Column(name = "created_at", updatable = false)
    private LocalDateTime createdAt = LocalDateTime.now(); // 创建时间

    @Column(name = "updated_at")
    private LocalDateTime updatedAt = LocalDateTime.now(); // 最后更新时间

    @PreUpdate
    public void preUpdate() {
        this.updatedAt = LocalDateTime.now();
    }
}
